#include "../client/Rpc_client.hpp"
#include <thread>

void JsonResponsecb(const Json::Value& v)
{
    LOG(INFO,"cb res: %d",v.asInt());
}
int main()
{
    ns_rpc_client::RpcClient client(false, "127.0.0.1", 8080);

    Json::Value paras, res;
    paras["num1"] = 10;
    paras["num2"] = 20;
    bool ret = client.Call("Add", paras, res);
    if (ret != false)
    {
        LOG(INFO, "ret: %d", res.asInt());
    }

    // ns_rpc_call::RpcCaller::JsonAsyncResponse asyncres;
    // paras["num1"] = 20;
    // paras["num2"] = 30;
    // ret = client->Call("Add", paras, asyncres);
    // if (ret == true)
    // {
    //     auto result = asyncres.get();
    //     LOG(INFO, "ret: %d", result.asInt());
    // }

    // paras["num1"] = 30;
    // paras["num2"] = 40;
    // ret = client->Call("Add", paras, JsonResponsecb);
    // std::this_thread::sleep_for(std::chrono::seconds(1));
    return 0;
}